/**
 * 用户相关请求模块
 */

import request from '@/utils/request'

// 发送注册请求
export const register = data => {
  return request({
    method: 'post',
    url: '/users',
    data
  })
}

// 发送登录请求
export const login = params => {
  return request({
    method: 'get',
    url: '/users',
    params
  })
}

// 获取用户信息
export const getUserInfo = params => {
  return request({
    method: 'get',
    url: '/users',
    params
  })
}

// 修改用户信息
export const updateUserInfo = data => {
  return request({
    method: 'put',
    url: `/users/${data.id}`,
    data
  })
}

// 关注家政公司和家服人员列表
export const getFollows = params => {
  return request({
    method: 'get',
    url: 'follows',
    params
  })
}

// 新增关注家政公司和家服人员列表
export const initFollow = data => {
  return request({
    method: 'post',
    url: 'follows',
    data
  })
}

// 添加关注
export const addFollow = data => {
  return request({
    method: 'put',
    url: `follows/${data.userId}`,
    data
  })
}

// 取消关注
export const deleteFollow = data => {
  return request({
    method: 'put',
    url: `follows/${data.userId}`,
    data
  })
}
